1. Field of the Invention
The present invention generally relates to motion video encoding techniques and, more particularly, to techniques for adaptively selecting a coding mode. The present invention relates to, for example, MPEG encoders.
2. Description of the Related Art
(1)Techniques for Encoding Video Data
Predictive/interpolative coding, motion compensation, DCT (Discrete Cosine Transformation), quantization, or VLC (variable length coding) are in use for video coding systems.
In predictive coding, a current macroblock is compared with the reference macroblock and the difference between them is output to the DCT. The current macroblock is a block having 16.times.16 pels and is extracted from a current frame. The reference macroblock is a block having 16.times.16 pels and is extracted from a reference frame. The reference frame is a frame preceding the current frame or following the current frame. If the reference frame precedes the current frame, the predictive coding is called forward. If the reference frame follows the current frame, the predictive coding is called backward. If two reference frames, forward and backward, are used for the prediction and the average of the results is employed, the coding is interpolative.
As described above, the reference macroblock is extracted from the reference frame. This reference macroblock is desirably approximate to the current macroblock. Accordingly, the macroblock having the smallest predictive error is extracted from the reference frame, for example. The relative position of the above reference macroblock in the reference frame is usually different from that of the current macroblock in the current frame. This difference between the two positions is designated by a motion vector. The difference between each pel in the current macroblock and the corresponding pel in the reference macroblock, which is designated by the motion vector, is output to the DCT. This compensation is called "motion compensation".
In the DCT, a current block having 8.times.8 pels is converted to an 8.times.8 coefficient matrix Cij by using the DCT technique, and output to the quantizer. Here, the above current block is obtained by splitting the difference macroblock as shown in FIG. 3.
As shown in FIG. 4, the coefficient matrix Cij is divided by a certain divisor Qij ((quantizer scale q).times.(constant Kij proper to each coefficient Cij)), and the remainder is rounded off, and the quantized coefficient C'ij is zigzag scanned and then output to the variable length coder. Here, the constant Kij is given in a quantization matrix table.
When the value of the Kij and/or the q increases, the quantized coefficient data C'ij output from the quantizer contains more "0"'s and the compression rate rises. In the adaptive quantization, a bit rate of a bitstream output from the video encoder is monitored, and the quantizer scale is set such that the bit rate can meet the target value. That is, when the bit rate is less than the target value, the quantizer scale q is controlled to be smaller, and when the bit rate is greater than the target value, the quantizer scale q is controlled to be larger.
In the above variable length coding, e.g., Huffman coding, each quantized coefficient C'ij output from the quantizer is allocated a code having a length according to its frequency of occurrence.
(2)MPEG
One type of video compression system is proposed by the Moving Pictures Expert Group (MPEG), a committee within the International Standards Organization (ISO). The MPEG1 standard is given in the ISO/IEC11172, and the MPEG2 standard is given in the ISO/IEC13818.
The MPEG system integrates a number of well-known data compression techniques into a single system. These include motion-compensated predictive/interpolative coding, DCT, adaptive quantization, and VLC.
As shown in FIG. 2, I, P, and B-pictures are in use in the MPEG standard. The I-picture is composed of intra-macroblocks coded by only DCT, quantization, and VLC. That is, the above mentioned motion-compensated predictive/interpolative coding is not used for the I-picture. The I-picture is decoded without requiring any motion vectors.
The P-picture is composed of the intra macroblocks and forward predictive macroblocks. The P-picture is decoded using motion vectors from a preceding I or P-picture. The B-picture is composed of the intra macroblocks, forward predictive macroblocks, backward predictive macroblocks, and interpolative macroblocks. The B-picture is decoded using motion vectors from both preceding I or P-picture and following I or P-picture.
(3)Coding Mode
Six types of motion compensation, frame MC, field MC, and dual-prime MC, each for frame-construction, and field MC, 16.times.8 MC, and dual-prime MC, each for field-construction, are permitted in the MPEG standard.
Three types of predictive direction, forward direction, backward direction, and dual (forward and backward) direction, are permitted in the MPEG standard.
Accordingly, there are plural types of motion compensation modes in the MPEG standard. The number of the motion vector is dependent on the motion compensation mode.
Predictive coding mode without motion compensation and intra coding mode are permitted in the MPEG standard.
Accordingly, there are plural types of coding modes in the MPEG standard. In the coding, a suitable coding mode is selected for each macroblock from among the permitted coding modes. For example, in the inter picture predictive coding, the coding mode having the smallest predictive error is selected, and when the smallest predictive error exceeds the predetermined threshold, the intra coding is selected. Here, the predictive error is, for example, the mean square error ofthe difference between the current macroblock and the reference macroblock, or the mean absolute difference between them.
(4)Prior Art
As prior art related to the detection of the motion vector, there have been techniques disclosed in Japanese Unexamined Patent Publications Nos. 4-145777, 4-79484, 3-40687, 4-207790, 4-234276, and 4-40193, for example.
As prior art related to the decision circuit which selects either the intra coding or the inter-picture coding, there have been techniques disclosed in Japanese Unexamined Patent Publications Nos. 6-133301 and 5-137129, for example.
As prior art related to the total amount of code output from the encoder which comprises the motion-compensated predictive/interpolative coder, the DCT, the adaptive quantizer, and the VLC, there have been techniques disclosed in Japanese Unexamined Patent Publications Nos. 4-215384, 2-29180, and 2-222389, for example.